package com.ibo.demo;

import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;

import java.io.InputStream;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        String str = "给我";
        PinyinUtil pinyinUtil = new PinyinUtil(this);
        String hanzi = "汉沽阿发松岛枫阿发的您好啊啊啊倒萨发生的阿达";
        System.out.println("####   "+pinyinUtil.getPinyinWithTone(str));

//        String str = "我们只需要将格式化后的拼音与汉字,传给我们自己定义的组件即可。";
//        String str = "著作权归作者所有。商业转载请联";
//        String str = "商业转载";



        PinyinTextView pinyinTv = (PinyinTextView) findViewById(R.id.tv);

        pinyinTv.setPinyin(PinyinTools.getPinyinString(str));
        pinyinTv.setHanzi(PinyinTools.getFormatHanzi(str));

    }
}
